﻿
namespace RPAAction.Data_CSO
{
    class ExcelDataReaderWithTag : ExcelDataReader
    {
        /// <summary>
        /// tagTitle 和 tagValue 参数用来标记输出的Excel数据
        /// </summary>
        /// <param name="rfcTable"></param>
        /// <param name="tagTiele"></param>
        /// <param name="tagValue"></param>
        public ExcelDataReaderWithTag(string tagTitle, object tagValue, string ExcelPath = null, string Sheet = null, string range = "used", int MaxCashCount = 10000)
            : base(ExcelPath, Sheet, range, MaxCashCount)
        {
            TagTitle = tagTitle;
            TagValue = tagValue;
        }

        public override int FieldCount => base.FieldCount + 1;

        public override string GetName(int ordinal)
        {
            return ordinal == 0 ? TagTitle : base.GetName(ordinal - 1);
        }

        public override object GetValue(int ordinal)
        {
            return ordinal == 0 ? TagValue : base.GetValue(ordinal - 1);
        }

        private readonly string TagTitle;
        private readonly object TagValue;
    }
}
